######################################################## 
## MOD Title: Send Email Notification to Multiple users on New Registration
## MOD Author: ycl6 < ycl6@users.sourceforge.net > (Y.C. LIN) http://macphpbbmod.sourceforge.net/
## MOD Description: With this MOD, email notification will be sent to multiple ACP-configured users (preferably administrator(s))
## MOD Version:	1.0.0
## 
## Installation Level: Easy
## Installation Time: 3 Minutes 
##
## Files To Edit: 3
##	includes/usercp_register.php
##	language/lang_english/lang_admin.php
##	templates/subSilver/admin/board_config_body.tpl
##
## Included Files: 0
##
## License: http://opensource.org/licenses/gpl-license.php GNU Public License v2 
################################################################# 
## For security purposes, please check: http://www.phpbb.com/mods/
## for the latest version of this MOD. Although MODs are checked
## before being allowed in the MODs Database there is no guarantee
## that there are no security problems within the MOD. No support
## will be given for MODs not found within the MODs Database which
## can be found at http://www.phpbb.com/mods/
############################################################## 
## Author Notes:
##	Tested on 2.0.17. Can be installed using EasyMOD 0.2.1a
##
##	Install "Admin Email notification on New Registration" first
## 
############################################################## 
## MOD History: 
##
##   2005-10-01 - Version 1.0.0
##      - Initial Release
## 
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
##############################################################

# 
#-----[ OPEN ]------------------------------------------ 
# 
language/lang_english/lang_admin.php

# 
#-----[ FIND ]------------------------------------------ 
#
$lang['Enable_notify_admin_new_reg_userid'] = 'Admin Userid';
$lang['Enable_notify_admin_new_reg_userid_explain'] = 'Enter the userid of the person that will receive the notification';

# 
#-----[ REPLACE WITH ]------------------------------------------ 
#
$lang['Enable_notify_admin_new_reg_userid'] = 'Admin Userid(s)';
$lang['Enable_notify_admin_new_reg_userid_explain'] = 'Enter the userid(s) of the person(s) that will receive the notification.<br />For multiple IDs, please enter the userid on a separate line.';

# 
#-----[ OPEN ]------------------------------------------ 
# 
includes/usercp_register.php

# 
#-----[ FIND ]------------------------------------------ 
#
			if ( $board_config['notify_admin_new_reg'] )
			{
				$admin_profile = array();
				$admin_profile = get_userdata($board_config['notify_admin_new_reg_userid']);

				$use_template = (empty($admin_profile)) ? $board_config['default_lang'] : $admin_profile['user_lang'];
				$email_address = (empty($admin_profile)) ? $board_config['board_email'] : $admin_profile['user_email'];
				$admin_name = (empty($admin_profile)) ? $lang['Administrator'] : $admin_profile['username'];
				
				include_once($phpbb_root_path . 'includes/emailer.'.$phpEx);
				$emailer = new emailer($board_config['smtp_delivery']);

				$emailer->from($board_config['board_email']);
				$emailer->replyto($board_config['board_email']);

				$emailer->use_template('notify_admin_new_reg', stripslashes($use_template));
				$emailer->email_address($email_address);
				$emailer->set_subject($lang['Notify_admin_new_reg']);

				$emailer->assign_vars(array(
					'ADMIN_NAME' => $admin_name,
					'SITENAME' => $board_config['sitename'],
					'USER_NAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
					'EMAIL_SIG' => (!empty($board_config['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '',
					'USER_PROFILE' => $server_url . '?mode=viewprofile&' . POST_USERS_URL . '=' . $user_id)
				);
				$emailer->send();
				$emailer->reset();
			}

# 
#-----[ REPLACE WITH ]------------------------------------------ 
#
			if ( $board_config['notify_admin_new_reg'] )
			{
				$userids = explode("\n", $board_config['notify_admin_new_reg_userid']);

				for ($i=0; $i<count($userids); $i++)
				{
					$admin_profile = array();
					$admin_profile = get_userdata(intval($userids[$i]));

					if (!empty($admin_profile))
					{
						$use_template = $admin_profile['user_lang'];
						$email_address = $admin_profile['user_email'];
						$admin_name = $admin_profile['username'];

						include_once($phpbb_root_path . 'includes/emailer.'.$phpEx);
						$emailer = new emailer($board_config['smtp_delivery']);

						$emailer->from($board_config['board_email']);
						$emailer->replyto($board_config['board_email']);

						$emailer->use_template('notify_admin_new_reg', stripslashes($use_template));
						$emailer->email_address($email_address);
						$emailer->set_subject($lang['Notify_admin_new_reg']);

						$emailer->assign_vars(array(
							'ADMIN_NAME' => $admin_name,
							'SITENAME' => $board_config['sitename'],
							'USER_NAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
							'EMAIL_SIG' => (!empty($board_config['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '',
							'USER_PROFILE' => $server_url . '?mode=viewprofile&' . POST_USERS_URL . '=' . $user_id)
						);

						$emailer->send();
						$emailer->reset();
					}
				}
			}

# 
#-----[ OPEN ]------------------------------------------ 
# 
templates/subSilver/admin/board_config_body.tpl

# 
#-----[ FIND ]------------------------------------------ 
#
		<td class="row2"><input class="post" type="text" maxlength="255" name="notify_admin_new_reg_userid" value="{NOTIFY_ADMIN_NEW_REG_USERID}" /></td>

# 
#-----[ REPLACE WITH ]------------------------------------------ 
#
		<td class="row2"><textarea name="notify_admin_new_reg_userid" rows="5" cols="30">{NOTIFY_ADMIN_NEW_REG_USERID}</textarea></td>

# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM 
